#define _CRT_SECURE_NO_WARNINGS
#pragma warning(disable : 4996)
#pragma warning(disable : 6031)

#include <stdio.h>

int main()
{
	int arr[10][10] = { 0 };
	int i = 0;
	int j = 0;
	int n = 0;
	scanf("%d", &n);
	int sum = 0;
	for (i = 0;i < n;i++)
	{
		for (j = 0;j < n;j++)
		{
			scanf("%d", &arr[i][j]);

			while (i > j)
			{
				sum += arr[i][j];
				break;
			}
		}
	}
	if (sum==0)
	{
		printf("YES\n");
	}
	else
	{
		printf("NO\n");
	}
	return 0;
}
